
/**
 * 计算两点之间抛物线
 * @param {*} startPoint 
 * @param {*} endPoint 
 * @param {*} MaxHeight 
 * @returns 
 */

export default function getParabolaVertex( startPoint , endPoint , MaxHeight){
  let positions = []
  let xCenter = startPoint[0] + (endPoint[0] - startPoint[0]) / 2
  let yCenter = startPoint[1] + (endPoint[1] - startPoint[1]) / 2
  const controlPoint = [xCenter , yCenter , MaxHeight]
  
  // 创建三维二次贝塞尔曲线
  const curve = new THREE.QuadraticBezierCurve3(
    new THREE.Vector3(...startPoint),
    new THREE.Vector3(...controlPoint),
    new THREE.Vector3(...endPoint)
  )
  const points = curve.getPoints(100) // 曲线的分段数量
  points.forEach(point => {
    positions.push(point.x , point.y , point.z)
  })
  return positions
}